<?php
namespace App\Services\Industry;

use App\Model\Industry;
use App\Services\CommonService;

class IndustryService extends CommonService
{
    //写完逻辑代码 调用数据库
    //判断传来的id是否正确
    public function sel(){
        //调用model层进行查询
        $result = Industry::orderBy('industry_sort','asc')->get();
        return $this->success($result);
    }
    /**
     * 添加热门行业
     */
    public function add($request){
        return Industry::create(['industry_name'=>$request['industry_name'],'industry_img'=>$request['industry_img'],'industry_ishost'=>$request['industry_ishost'],'industry_sort'=>$request['industry_sort']]);
    }
    /**
     * 删除热门行业
     */
    public function del($id){
        return Industry::destroy($id);
    }
}